Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

feat!: remove legacy per-service ports - #98

Merged
Blind-Striker merged 8 commits into
release/3.1from
feat/remove-legacy-ports
Nov 30, 2026
Merged

Blind-Striker merged 8 commits into
release/3.1from
feat/remove-legacy-ports

Conversation

@Blind-Striker

@Blind-Striker Blind-Striker commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

T6 of LocalStack.Client 3.1 removes the legacy per-service ports. Every endpoint now uses EdgePort (spec v2 §3.12 LP and §3.13 RM; ADR 0003, D3). It closes #26, and #25 is closed as obsolete (D4).

Gate: IL scan before removal (lead's condition)

Before removing anything, I scanned the published LocalStack.Client.Extensions 3.0.0 assets (netstandard2.0, net10.0, net11.0) with ilspycmd metadata tables and System.Reflection.Metadata, against release/3.1 b21a5a1.

  • Result: CLEAN. No asset references any member this PR removes.
  • Constants.UseLegacyPorts is a static literal, so IL cannot reference it as a field. The tagged Extensions source does not use it.
  • The only trace is the binder's ldstr "UseLegacyPorts" configuration key. LP-3 covers that.
  • The same scan found the separate ISession.CreateClientByInterface<T>(bool) gap. That fix is in fix: keep Extensions 3.0 binaries working on Core 3.1 #97.

What changes

  • LP-1: every AwsServiceEndpoint (its port and its URL) uses the configured EdgePort.
  • LP-2 / RM-1 removals:
    • IConfigOptions.UseLegacyPorts and ConfigOptions.UseLegacyPorts;
    • the ConfigOptions(string, bool, bool, int) constructor;
    • Constants.UseLegacyPorts;
    • AwsServiceEndpointMetadata.Port and .ByPort(int);
    • IConfig.GetAwsServicePorts() / GetAwsServicePort(AwsService) and their Config implementations (decision 12; this overrides the plan, which kept them).
  • Constructor: ConfigOptions(string localStackHost = …, bool useSsl = …, int edgePort = …, bool useServiceUrl = false) replaces both the 3.0 four-argument constructor and the never-shipped 3.1 five-argument one (spec §4.2). The parameterless constructor stays.
  • Friend signature kept. Published Extensions 3.0.0 calls internal ConfigOptions.ApplyConfiguration(string?, bool?, bool? useLegacyPorts, int?) and passes the legacy value as argument 3. The signature, names and defaults are unchanged, and the method ignores argument 3. ConfigOptionsFriendContractTests is unchanged and green.
  • LP-3: the 3.1 binder no longer reads LocalStack:Config:UseLegacyPorts. A leftover key is ignored whatever its value, including "yes", which 3.0 rejected.
  • LP-4: GetServiceUrl(proto, host, port = null) keeps its signature. A null port becomes Constants.EdgePort.
  • RM-2: the private endPointPattern constructor parameter is removed. The public EndPointPattern property returns the common pattern. ToString() drops the port.
  • RM-3: the generated-registration signatures are untouched.
  • Parked minor from fix: let AWS-standard endpoints win and sign with RegionName #92: the RequireTraceForFailsafe regex now also accepts space-separated DefineConstants. Proof: -p:DefineConstants='DEBUG TRACE' failed the old guard and passes the new one; -p:DefineConstants=DEBUG still fails with the guard's message.

Package-validation suppressions (each with its spec reference)

dotnet pack -p:GenerateCompatibilitySuppressionFile=true added exactly these 40 CP0002 entries to src/LocalStack.Client/CompatibilitySuppressions.xml. The 48 existing entries are retained, the Extensions file is byte-identical, and the baseline stays 3.0.0.

Removed member Reference net472 netstandard2.0 net10.0 net11.0
IConfigOptions.UseLegacyPorts LP-2 ✓ ✓ ✓ ✓
ConfigOptions.UseLegacyPorts LP-2 ✓ ✓ ✓ ✓
ConfigOptions(string, bool, bool, int) LP-2 ✓ ✓ ✓ ✓
Constants.UseLegacyPorts LP-2 ✓ ✓ ✓ ✓
AwsServiceEndpointMetadata.Port LP-2 ✓ ✓ ✓ ✓
AwsServiceEndpointMetadata.ByPort(int) LP-2 ✓ ✓ ✓ ✓
IConfig.GetAwsServicePorts() RM-1 / decision 12 ✓ ✓ ✓ ✓
IConfig.GetAwsServicePort(AwsService) RM-1 / decision 12 ✓ ✓ ✓ ✓
Config.GetAwsServicePorts() RM-1 / decision 12 ✓ ✓ ✓ ✓
Config.GetAwsServicePort(AwsService) RM-1 / decision 12 ✓ ✓ ✓ ✓

These match the spec §4.1 measurements: 24 LP-2 entries and 16 decision-12 entries. The generated XML carries no comments, so the references live in this table.

Retained public members

  • AwsServiceEndpoint.Port, which is now always EdgePort.
  • GetServiceUrl and EndPointPattern (C2 (a), owner).
  • ByName, ByEnum, ISessionReflection.SetClientRegion and AddDefaultAwsOptions(AWSOptions) (RM-2).

Tests (red first)

Test Base → after
ConfigurationTests.Every_Endpoint_Should_Use_The_Edge_Port With the legacy friend argument set, all 133 endpoints had the wrong port → pass
ServiceCollectionExtensionsTests.AddLocalStack_Should_Ignore_A_Leftover_UseLegacyPorts_Key_Of_Any_Value ("true", "false", "yes") "true" gave 4572, "yes" threw a Boolean conversion error → all pass
GetServiceUrl_Should_Use_The_Default_Edge_Port_When_The_Port_Is_Null 4572 → 4566
DifferenceComparerTests (framework-scoped deltas, below) 8 passed / 4 failed → 12 / 0

Existing-test edits (authorized list):

  • Removed contracts: the legacy-property test, the four GetAwsServicePort(s) tests, and the four legacy-on rows in each of the two URL theories. Every_Endpoint_Should_Use_The_Edge_Port covers them.
  • Assertions removed, tests kept: the legacy-key assertions in the constants, options, binding, GetConfigOptions and fixture tests.
  • 4569 → 4566: SessionCompatibilityTests.CreateClient_Should_Use_Injected_Reflection_For_Metadata_Config_Style_And_Credentials and GeneratorTests.Generator_Should_Leave_Private_Closed_Generic_Clients_To_The_Fallback, because the injected config no longer passes useLegacyPorts: true.
  • No expected-value change: every other call site, probe, fixture and sandbox edit only drops legacy inputs. The two old CA1054 suppressions on string-URL inputs became unnecessary and were removed.

Differential (T-6), row B20

  • B20 is no longer pending. The "yes" scenarios moved to the sub-row B20/non-boolean, following the existing convention (B4/use-ssl).
    • B20 records the per-service proxy port changing to the edge port (4572/4575 → 4566).
    • B20/non-boolean records binding failure → success.
  • The comparer requires every listed delta to occur, and the 3.0 failure message differs by runtime. .NET Framework's Boolean.Parse resource omits the value. So a delta may now carry an optional "targetFramework" (exact short TFM). It then applies, both as accepted and as required, only on that lane. Unscoped deltas behave as before.
  • B20/non-boolean has one creation delta for net10.0 and one for net472.
  • The net472 chain is inferred, not run. The published binder (netstandard2.0 asset) uses BooleanConverter.ConvertFromInvariantString wrapped in InvalidOperationException, and the .NET Framework converter wraps the FormatException. The Windows CI lane on this PR is the evidence.
  • No other row and no other comparer rule changed. Linux net10.0: 2,165 scenarios per harness, 0 failing rows.

Docs

  • READMEs: the UseLegacyPorts row is removed and the service-URL example now uses the new constructor. The three copies are byte-identical.
  • ADR 0003: marked implemented in place, per docs/adr/README.md. Also updated: ADR 0005, GLOSSARY.md, client-runtime.md, docs/reference/endpoint-behavior.md, and testing-style.md (framework-scoped deltas).
  • CHANGELOG:
    • Breaking changes: the removed members, and a note that Constants.UseLegacyPorts is a recompile-only break because compiled reads inlined false.
    • Migrating from 3.0:
      • a positional third argument is now edgePort;
      • new ConfigOptions(host, false, default) still compiles but now sets port 0, so remove the argument or name edgePort:.
    • Behavior changes item 12: an already-compiled GetServiceUrl("http", "host") still binds, but it now uses 4566 instead of the per-service port. This applies in either UseLocalStack mode.
  • Not here by decision: guidance on upgrading Client and Extensions together, and the binary shim. Those are in fix: keep Extensions 3.0 binaries working on Core 3.1 #97.
  • Issue comments: the Support for LOCALSTACK_HOST, EDGE_PORT and USE_SSL #25/Remove Legacy Support #26 comment drafts are ready. I'll post them on approval after merge.

Verification

Linux, after the last code commit:

Suite net10.0 net11.0
LocalStack.Client.Tests 176/176 176/176
LocalStack.Client.Extensions.Tests 66/66 66/66
LocalStack.Client.Integration.Tests 482/482 482/482
LocalStack.Client.Generators.Tests 66/66 —
LocalStack.Client.Compatibility.Tests 18/18 —

Other checks:

  • Functional, net10.0, token-free profiles (LocalStackAuth!=Required): 188/0.
  • Native AOT, net10.0 linux-x64: published and run, 33 passed and 3 skipped. The skips are the live cases; LOCALSTACK_NATIVE_AOT_HOST was unset.
  • Package consumer: net10.0, fresh cache, from packed 3.1.0 packages. Passed.
  • ./build.sh --target check-source: 0 findings. The four sandbox projects build.
  • Not run locally: net472/Windows and the authenticated current-image profile. CI covers both.

Review

All three review passes were Astra (high), because GLM was at its usage limit.

Pass Verdict Findings and resolution
1 FIX NEEDED Important: the B20 net472 message. Important: the silent port 0 from default. Minor: the const and GetServiceUrl classification, and the sandbox examples. All fixed in 3f472c5/fcd691c/15c4b0f.
2 All four addressed Two new Minor doc findings: the scope of the item-12 qualifier, and authoring guidance for scoped deltas. Fixed in 243a0ff.

Rebase onto #97

#98 is rebased onto release/3.1 c08f2b4, which includes the binary shim from #97.

  • Conflicts resolved:
  • Linux re-run after the rebase:
    • Client 182/182 on net10.0 and net11.0, including the shim tests;
    • Extensions 66/66 on both;
    • Integration 482/482 on both;
    • MixedVersion 4/4 on net10.0 (published Extensions 3.0.0 still binds on this Core; the legacy friend argument is ignored);
    • Compatibility 18/18 and Generators 66/66 on net10.0;
    • check-source succeeded, and the READMEs are byte-identical.

Follow-ups

Figures (added lines)

  • Catalog initializer rewrite (mechanical): 133.
  • Generated suppression XML: 280.
  • Other production: 25.
  • Tests and JSON: 273.

@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@Blind-Striker
Blind-Striker force-pushed the feat/remove-legacy-ports branch from 243a0ff to c8d3450 Compare November 30, 2026 10:52
@Blind-Striker
Blind-Striker merged commit 6cd31d4 into release/3.1 Nov 30, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant